﻿using System;

namespace FuncAndAction
{
    class Program
    {
        public delegate void DCalculator();//输出委托
        public delegate int DAction(int a, int b);
        static void Main(string[] args)
        {
            Calculator calculator = new Calculator();
            DCalculator dCalculator = new DCalculator(calculator.Report);
            calculator.Report();
            dCalculator.Invoke();
            dCalculator();



            DAction dAction1 = new DAction(calculator.Add);
            DAction dAction2 = new DAction(calculator.Sub);
            int a = 20;
            int b = 30;
            int z = 0;
            z = dAction1.Invoke(a, b);
            Console.WriteLine(z);
            z = dAction2.Invoke(a, b);
            Console.WriteLine(z);


        }
    }
}
